<?xml version="1.0" encoding="utf-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE >
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>竞争对手管理</title>
		<!-- 引入样式 -->
		<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
		<script src="https://unpkg.com/vue/dist/vue.js"></script>
		<!-- 引入组件库 -->
		<script src="https://unpkg.com/element-ui/lib/index.js"></script>
		<!-- 引入axios -->
		<script src="../js/axios.js"></script>
		<script src="../js/qs.js"></script>
		<!-- 导入jquery -->
		<script src="../js/jquery.min.js"></script>
		<style type="text/css">
		<style type="text/css">
.loading{
        width: 100%;
        height: 100%;
        position: fixed;
        background-color: white;
        top: 0px;
        left: 0px;
        z-index: 100;
}	
.loading .bigpic{
    width: 104px;
    height: 104px;
    background-image: url("../imgs/loading.gif") ;
    position: absolute;
    top: 0px;
    bottom: 0px;
    right: 0px;
    left: 0px;
    margin: auto;
}
.select{
width:130px;
}
 .bg-purple {
 
  }
  .grid-content {
    border-radius: 4px;
  }
.undo{
    background-image: url("") ;
}
		</style>
<!-- <script>
	document.addEventListener("readystatechange",function(){
		//对象尚未初始化
		if(document.readyState=="uninitialized"){
			console.log("readystatechange-uninitialized");
		}
		//对象正在加载
		if(document.readyState=="loading"){
			console.log("readystatechange-loading");
		}
		//对象加载数据完成
		if(document.readyState=="loaded"){
			console.log("readystatechange-loaded");
		}
		//可以操作对象，但还没完全加载
		if(document.readyState=="interactive"){
			console.log("readystatechange-interactive");
		}
		//对象已经加载完毕
	     if (document.readyState == "complete") {
	       console.log("readystatechange-complete");
	      }
	  });
	$(function(){
	    //读取数据是否加载成功
	    document.onreadystatechange=function(){
	        //判断页面读取状态   页面读取状态一共四中
	        if(document.readyState == "complete"){
	        //载入完成fadeOut();移除div样式
	            $(".loading").fadeOut();
	        }
	    }
	});
</script> -->
</head>
<body>
				<!-- 搜索 -->
<!-- 		<div class="loading">
			<div class="bigpic"><div class="bigpic"></div></div>
		</div> -->
				
<!--这一块代码表示页面上方的查询模块、以及包含列表名和新增按钮---开始-->
		<div id="bigbox" >
		 	<!--这一块代码表示页面上方的查询模块、以及包含列表名和新增按钮---开始-->

			 <div style="width: 100%;margin-left: 15px;display: block;" > 
				<i class="el-icon-caret-right" style="line-height: 40px;margin-right: 5px; float: left;"></i>
				<template style="margin-top: 50px;">
  			<el-select v-model="value7" placeholder="请选择" multiple style="float: left;width:200px;" @change="handleSelect" @visible-change="visibleChange()" @remove-tag="removeTag()"   >
  			<!-- :key="group.label",:key="item.value" -->
    		<el-option-group v-for="group in options3" :key="group.label"  :label="group.label" >
      		<el-option v-for="item in group.options"  :key="item.value" :label="item.label" :value="item.value">
     		 </el-option>
    		</el-option-group>
 			 </el-select>
				</template>
				<i class="el-icon-search" style="line-height: 40px;float: left;margin-left: 10px; width: 50px; height: 50px;"></i>
				<!-- 搜索框 -->
				<div style="display: block;margin-left: -20px;float: left;">
				<!-- state1Flag=false	 -->
			    <el-autocomplete class="inline-input" width="300px;" v-model="state1" :fetch-suggestions="querySearchAsync" placeholder="请输入内容" @select="handleSelect" @focus="stateManagement(true,1)" @blur="state1Flag=false">
			    	<el-select v-model="select" slot="append" placeholder="请选择" class="select" @change="clearData()">
			      	<el-option label="机会主题" value="1"></el-option>
			      	<el-option label="客户名称" value="2"></el-option>
			      	<el-option label="公司名" value="3"></el-option>
			    	</el-select>
			    </el-autocomplete>
				</div>
				
				<!-- 表单 -->
			<div style="width: 99%;float: left;" id="app2">
				<!-- <div style="float: left;margin-left: 30px;margin-top: -10px;"></div> -->
				
<el-row :gutter="20">
  <el-col :span="20">
  <div class="grid-content bg-purple" style="padding: 10px 0;">
  <span style="font-size: 13px;color: #333333;">竞争对手列表</span> 
	<!--   <div style="width:50px;height:40px;"></div>-->
    <el-tooltip  effect="dark" content="解除搜索，显示全部数据" placement="right" v-show="removeSearch">
      <el-button style="padding:2px 5px; border-radius: 8px;background-color:red;color:white;"v-on:click="removeSearch1()"><img src="../imgs/undo.png" style="width:13px;height:13px;"/><span style="font-size:10px;">解除搜索</span></el-button>
    </el-tooltip>		
  </div>
  </el-col>
  <el-col :span="4"><div class="grid-content bg-purple" style="padding-top:0px;margin-left:40px">
   <el-button size="small" icon="el-icon-circle-plus" v-on:click="loadInfo(0)" @click="dialogFormVisible = true" style="width: 80px;"> 新建</el-button> 
  </div>
  </el-col>
</el-row>

<!--这一块代码表示新增弹窗---开始-->
	<div style="float: right;display: block;margin-right: 20px;margin-top: -10px;" @click="deathWindow('form')" >

					<!-- 这里是弹窗--start-->					
					<el-dialog   title="新建竞争对手" :visible.sync="dialogFormVisible" width="70%"  >
					<hr style="border: 1px solid #000000;margin-top: -15px;" />
						<el-form :model="form" :rules="rules" label-width="150px" ref="form"  style="height: 690px; margin-top: 20px;">
							<el-row >
								<el-col :span="22">
									<el-form-item label="公司名:" prop="comName" >
										<el-input v-model="form.comName"></el-input>
									</el-form-item>
								</el-col>
								</el-row>															
							<el-row >
								<el-col :span="24">
						<el-form-item label="客户:" prop="customer">
						<!-- :fetch-suggestions="querySearchAsync"customerFlag:false,soltIdFlag:false-->
						<el-autocomplete v-model.trim="form.customer" :fetch-suggestions="querySearchAsync"  placeholder="请输入内容" @select="handleSelect" @focus="customerFlag=true" @blur="customerFlag=false">
						 <i slot="prefix" class="el-input__icon el-icon-search"></i>
						</el-autocomplete>
					    	</el-form-item>
								</el-col>
							</el-row>	
						<el-row style="margin-left: 10px;">	
								<el-col :span="12">
						<el-form-item label="对应机会:" prop="salTheme">
							<el-select v-model="form.salesOpportunity" filterable placeholder="未选" @focus="findBySales" required>
							<el-option v-for="item in salesOpportunitys" :key="item.value" :label="item.label" :value="item.value">
							</el-option>
							</el-select>						
					    	</el-form-item>
								</el-col>
						</el-row>
						<el-row style="margin-left: 10px;">	
								<el-col :span="12">
									<el-form-item label="价格:" prop="comPrice">
									<el-input v-model.number="form.comPrice" style="width:57%;"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="竞争能力:">
										<el-select v-model="form.comPower" filterable placeholder="未选" required>
											<el-option v-for="item in comPowers" :key="item.value" :label="item.label" :value="item.value">
											</el-option>
												</el-select>
											<el-tooltip content="Bottom center" placement="bottom">
												<div slot="content">数据字典</div>
												<i class="el-icon-document" id="newtool"></i>
											</el-tooltip>
									</el-form-item>
								</el-col>
							</el-row>
					<el-row style="margin-left: 10px;">
						<el-form-item label="竞争方案/竞争产品:">
						<el-input type="textarea"  style="width:82%" :rows="3"  v-model="form.competingProduct"> </el-input>
						</el-form-item>
						</el-row>							
					<el-row style="margin-left: 10px;">
						<el-form-item label="优势:">
						<el-input type="textarea"  style="width:82%" :rows="3"  v-model="form.advantages"> </el-input>
						</el-form-item>
						</el-row>
					<el-row style="margin-left: 10px;">
						<el-form-item label="劣势:">
						<el-input type="textarea"  style="width:82%" :rows="3"  v-model="form.inferiority"> </el-input>
						</el-form-item>
						</el-row>
					<el-row style="margin-left: 10px;">
						<el-form-item label="应对策略:">
						<el-input type="textarea"  style="width:82%" :rows="3"  v-model="form.comStrategies"> </el-input>
						</el-form-item>
						</el-row>						
						<hr style="border: 0.5px solid #EEEEEE;" />						
							<el-form-item style="float: right;margin-top: 40px;">
								<el-button @click="cancelForm('form')">取 消</el-button>
								<el-button type="primary" @click="submitForm('form')" >确定</el-button>
								<el-button @click="resetForm('form')">重置</el-button>
							</el-form-item> 
						</el-form>
					</el-dialog>
					<!--这里是弹窗--end-->
					
				</div>
				</div>
 

			
				<!--这一块代码表示新增弹窗---结束-->  					

	<!--这一块代码表示页面上方的查询模块、以及包含列表名和新增按钮---结束-->   						
				<!--这一块代码表示的删除提示弹窗---开始-->	
					<el-dialog title="提示" :visible.sync="dialogDelete" width="30%" append-to-body>
					 	 <span>你确定要删除吗？</span>
					  	<span slot="footer" class="dialog-footer">
					    <el-button @click="dialogDelete = false">取 消</el-button>
					    <el-button type="primary" @click="dialogDelete = false" v-on:click="Delete" >确 定</el-button>
					  </span>
					</el-dialog>
					<!--这一块代码表示的删除提示弹窗---结束-->	
					
   		<!--这一块代码表示表格的显示---开始-->	
			<!-- 表单 -->
			<div id="app3" >
			<!-- element-loading-spinner="el-icon-loading" element-loading-text="拼命加载中"-->
			
			<div id="print"  >
			<!-- printStart -->
					<el-table ref="multipleTable" tooltip-effect="dark" @selection-change="handleSelectionChange" :data="tableData3"
					 v-loading="tableloading"   :cell-style="cellStyle" :header-cell-style="cellStyle" 
						 border style="border:1px solid #ebeef5;width: 100%;"
					  element-loading-background="rgba(0, 0, 0, 0)"  >
						<el-table-column type="selection" width="35" v-if="printFlag1==false" >
						</el-table-column>				
						<el-table-column prop="comId" label="ID" >
						</el-table-column>
						<el-table-column prop="comName" label="公司名">
						</el-table-column>
						<el-table-column prop="customer" label=" 客户">
						</el-table-column>
						<el-table-column prop="comPrice" label="价格" >
						</el-table-column>			
						<el-table-column prop="salesOpportunity" label="对应机会" >
						</el-table-column>					
						<el-table-column prop="comPower" label="竞争能力" >
						</el-table-column>
						<el-table-column fixed="right" label="操作" width="120px" v-if="printFlag2==false" >
							<template slot-scope="scope">

								<el-tooltip content="Bottom center" placement="bottom">
									<div slot="content">编辑</div>								
									<i class="el-icon-edit" v-on:click="loadInfo(scope.row.comId)" @click="dialogrepair = true" style="font-size: 17px;"></i>
								</el-tooltip>
									<el-tooltip content="Bottom center" placement="bottom">
									<div slot="content">删除</div>
									<i class="el-icon-delete" style="margin: 0px 10px;font-size: 17px;"  @click="DeleteShow(scope.row.comId)" ></i>
								</el-tooltip>							
							</template>
						</el-table-column>
						
					</el-table>
				</div>			
			<!--这一块代码表示表格的显示---结束-->						
  <!--这一块代码表示修改弹窗---开始-->
	<div style="float: right;display: block;margin-right: 20px;margin-top: -10px;" @click="deathWindow('form')" >

					<!-- 这里是弹窗--start-->					
					<el-dialog   title="编辑竞争对手" :visible.sync="dialogrepair" width="70%"  >
					<hr style="border: 1px solid #000000;margin-top: -15px;" />
						<el-form :model="form" :rules="rules" label-width="150px" ref="form"  style="height:720px; margin-top: 20px;">
							<el-row >
								<el-col :span="22">
									<el-form-item label="公司名:" prop="comName" >
										<el-input v-model="form.comName"></el-input>
									</el-form-item>
								</el-col>
								</el-row>															
							<el-row >
								<el-col :span="24">
						<el-form-item label="客户:" prop="customer">
						<!-- :fetch-suggestions="querySearchAsync"customerFlag:false,soltIdFlag:false-->
						<el-autocomplete v-model.trim="form.customer" :fetch-suggestions="querySearchAsync"  :disabled="true" placeholder="请输入内容"  @select="handleSelect" @focus="customerFlag=true" @blur="customerFlag=false">
						 <i slot="prefix" class="el-input__icon el-icon-search"></i>
						</el-autocomplete>
					    	</el-form-item>
								</el-col>
							</el-row>	
						<el-row style="margin-left: 10px;">	
								<el-col :span="12">
						<el-form-item label="对应机会:" prop="salTheme">
							<el-select v-model="form.salesOpportunity" filterable placeholder="未选" @focus="findBySales" required>
							<el-option v-for="item in salesOpportunitys" :key="item.value" :label="item.label" :value="item.value">
							</el-option>
							</el-select>						
					    	</el-form-item>
								</el-col>
						</el-row>	
						<el-row style="margin-left: 10px;">	
								<el-col :span="12">
									<el-form-item label="价格:" prop="comPrice">
									<el-input v-model.number="form.comPrice" style="width:57%;"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="竞争能力:">
										<el-select v-model="form.comPower" filterable placeholder="未选" required>
											<el-option v-for="item in comPowers" :key="item.value" :label="item.label" :value="item.value">
											</el-option>
												</el-select>
											<el-tooltip content="Bottom center" placement="bottom">
												<div slot="content">数据字典</div>
												<i class="el-icon-document" id="newtool"></i>
											</el-tooltip>
									</el-form-item>
								</el-col>
							</el-row>
					<el-row style="margin-left: 10px;">
						<el-form-item label="竞争方案/竞争产品:">
						<el-input type="textarea"  style="width:82%" :rows="3"  v-model="form.competingProduct"> </el-input>
						</el-form-item>
						</el-row>							
					<el-row style="margin-left: 10px;">
						<el-form-item label="优势:">
						<el-input type="textarea"  style="width:82%" :rows="3"  v-model="form.advantages"> </el-input>
						</el-form-item>
						</el-row>
					<el-row style="margin-left: 10px;">
						<el-form-item label="劣势:">
						<el-input type="textarea"  style="width:82%" :rows="3"  v-model="form.inferiority"> </el-input>
						</el-form-item>
						</el-row>
					<el-row style="margin-left: 10px;">
						<el-form-item label="应对策略:">
						<el-input type="textarea"  style="width:82%" :rows="3"  v-model="form.comStrategies"> </el-input>
						</el-form-item>
						</el-row>						
						<hr style="border: 0.5px solid #EEEEEE;" />	
						<hr style="border: 0.5px solid #EEEEEE;" />						
							<el-form-item style="float: right;margin-top: 40px;">
								<el-button @click="cancelForm('form')">取 消</el-button>
								<el-button type="primary" @click="submitForm('form')" v-on:click="dialogrepair= false">保存</el-button>
							</el-form-item>
						</el-form>
					</el-dialog>
					<!--这里是弹窗--end-->
					
				</div>
				</div>
 

			</div><!-- 这个div是bigbox-->
  <!--这一块代码表示修改弹窗---结束-->					
					<!--这一块代码最下方的分页、打印和导出Excel---开始-->
					<div style="margin-top: 10px">
						<div style="display: block; float: left;margin-left: 5px;">
							<el-tooltip content="Bottom center" placement="bottom">
								<div slot="content">删除</div>
								<i class="el-icon-delete" style="margin: 8px;font-size: 17px;"></i>
							</el-tooltip>
						</div>
						<!-- 分页 -->
						<div style="display: block; float: left; margin-left: 300px;">
							<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage4"
							 :page-sizes="page.pageCentent" :pager-count="5" :page-size="100" layout="total, sizes, prev, pager, next, jumper" :total="page.AllpageNumber">
							</el-pagination>
						</div>
						
						<div style="display: block; float: right;margin-right: 15px;">
							<el-tooltip content="Bottom center" placement="bottom">
								<div slot="content">打印</div>
								<el-button circle size="mini"><i class="el-icon-printer" style="font-size: 17px;" @click="print(7)"></i></el-button>&nbsp;
							</el-tooltip>

							<el-tooltip content="Bottom center" placement="bottom">
								<div slot="content">导出Excel</div>
								<el-button circle size="mini"><i class="el-icon-tickets" style="font-size: 17px;"></i></el-button>
							</el-tooltip>

						</div>
					</div>
				</template>
			</div>
	</div><!--这个/div是id="bigbox"的-->
	</div>
<!--这一块代码最下方的分页、打印和导出Excel---结束-->
		
		<!-- src="../js/sales/saleOpp.js" -->
		<script type="text/jscript" >
					var Main1 = {
							data() {	
								//检查输入是否为数字,是否为空  
							      var checkcomPrice = (rule, value, callback) => {
							          setTimeout(() => {
							        	 if(value==null||value==''){
							        		 callback();
							        	 }
							            if (!Number.isInteger(value)) {
							              callback(new Error('请输入数字值'));
							            } else {
							                callback();
							            }
							          }, 1000);
							        };
								//检查机会主题是否重复，是否为空    
								   var checkComName = (rule, value, callback) => {
									   if(value==null||value==''){
										   callback(new Error('公司名为必填项'));  
									   }else{
										   callback();
									   }
									  };
								     //检查输入的客户数据是否存在,是否为空  
									 var checkCustomer = (rule, value, callback) => {
										   if(value==null||value==''){
											   callback(new Error('对应客户为必填项'));  
										   }
									          setTimeout(() => {
									            if (this.restaurants==null||this.restaurants=='') {
									              callback(new Error('您输入的客户名称不存在，请确认后再输入'));
									            } else {
									                callback();
									            }
									          }, 1000);
									   };			        								
								return {										
									tableData3:${salesOpp},//表格数据
									currentPage1: 5,//分页数据
									currentPage2: 5,//分页数据
									currentPage3: 5,//分页数据
									currentPage4: 4,//分页数据
									multipleSelection: [],
									dialogrepair: false,
									dialogDelete:false,
									tableloading:false,
									removeSearch:false,								
							          value7:'',
							          value7Copy:'',
							          printFlag1:false,//这个值是为了在打印的时候去掉一些不必要的元素
							          printFlag2:false,//这个值是为了在打印的时候去掉一些不必要的元素
							          value7Flag:false,
							          option:'',
							          obj2:null,
							          state1:'',
							          state1Copy:'',
							          salStageCopy:'',//这个是销售机会负责人的copy
							          matchFlag:false,
							          state1Flag:false,
							          state1Session:false,
									  select:'1',//表示选择框的默认值，用于页面头部的动态搜索
								      selectCopy:'1',
							          
							          /* 添加和修改的声明变量区*/
										form: {
											advantages:'',//优势
											comName:'',
											comPower:'',
											comPrice:'',
											comStrategies:'',//应对策略
											inferiority:'',	//劣势									
											salesOpportunity:'',//销售机会机会主题
											customer:'',//客户的数据
											state:1,//状态值，好像没有用到
											competingProduct:'',//竞争方案或者竞争产品
											comId:''//竞争对手id
										},
									/*								
									 * 下面这一段表示在搜索选择是获取对应的选择值，但是这个在有连级的情况下才需要写
									 * salId：在修改时获取对应的id传到后台
									 * */
									comId:'',//销售机会主题id
									salId:'',
									gdID: '',//这个是获取了客户的id
									conID:'',//获取联系人id
									comPowers:'',
									salesOpportunitys:'',

							       /* 添加和修改的声明变量区*/
							       
									/*这块代码表示对输入数据的验证*/
 									rules:{
									customer:[
									{	
										required: true,validator:checkCustomer, trigger: 'change'
									}],
									comPrice:[
										{
											validator:checkcomPrice, trigger: 'blur' 
										}
									],
									comName:[{
										required: true,validator:checkComName, trigger: 'blur'										
									}]									
								}, 
								/*这块代码表示对输入数据的验证*/
									page:{
										pageCentent:[4, 6, 10],	
										AllpageNumber:${salesCount}
									},
									pageNumber:1,								
									pageCententSelect:4,								
									value8: '',
									valuecust: '',
									DId:0,
									data:[],
									flag:false,
									dialogFormVisible: false,
									customerFlag:false,
									soltIdFlag:false,
									
									/* 日期选择 */
									pickerOptions1: {
										disabledDate(time) {
											return time.getTime() > Date.now();
										},
										shortcuts: [{
											text: '今天',
											onClick(picker) {
												picker.$emit('pick', new Date());
											}
										}, {
											text: '昨天',
											onClick(picker) {
												const date = new Date();
												date.setTime(date.getTime() - 3600 * 1000 * 24);
												picker.$emit('pick', date);
											}
										}, {
											text: '一周前',
											onClick(picker) {
												const date = new Date();
												date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
												picker.$emit('pick', date);
											}
										}]
									},
									gettoday: new Date(),
									getDate:'',
									gettime: new Date(),
									prostarttoday:'',
									prosalettoday:'',
							        restaurants: [],
							        timeout:  null,
							        options3: [
							        	{
								            label: '全部数据',
								            options: [{
								            	label:'全部数据',
								            	value:''
								            	}]						        		
							        	},{
							            label: '竞争能力',
							            options: []
							          }]
								}
							},
							methods:{
				
								//通过客户id查询对应的销售机会
								findBySales(){
									var _this=this;
									if(this.gdID!=null||this.gdID!=0){
									 	axios.get("/sales/abroadsolutionsales",
							           			//参数转换
							           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
							           			//ajax请求成功的回调函数
							           			{
									 		params:{
									 			custID:this.gdID
									 		}
							           			}
							          			).then(function(response){					          				
							           			console.log("回调成功，获取了服务器端返回的值v");
							           			console.log(response.data);
												_this.salesOpportunitys=response.data;
							           	}).catch(function(){
							           		alert("加载销售机会信息出错了");
							           	});											
									}
	 															
								},
								//这个是新增以及修改 表单提交事件
							      submitForm(formName) {
									//alert(this.form.salStage);
												var i=" ";
									    	    var obj = {};
												var _this=this;

												i=this.form.customer;
												this.form.customer=this.gdID+'';
												var form = this.form;
												
												console.log(form.salesOpportunity);
												if(_this.salesOpportunitys==null||_this.salesOpportunitys==0){
													form.salesOpportunity=this.salId+'';										
												}
												//竞争能力
 												if(_this.form.comPower!=null&&_this.form.comPower!=''){
										    	    obj = this.comPowers.find((a)=>{										    	    	
											    	      return a.label ===_this.form.comPower; 
											    	    });
										    	    if(_this.form.comPower=="忽略"){
										    	    	_this.form.comPower='1078';
										    	    }
											    	   if(obj!=null){
															console.log("再看看："+obj);												    		   
												    	    _this.form.comPower=obj.value;
											   		 }
												} 												

										        this.$refs[formName].validate((valid) => {
										        	
											          if (valid) {
										           			console.log(JSON.stringify(form));
														 	axios.get("/sales/Addcompetitor",
												           			//参数转换
												           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})	
											           			{
											           		params:form 
											           			}


												           			//json.stringify(this.form)
												           			//ajax请求成功的回调函数
												          			).then(function(response){									    	  					          									          			
												           			_this.$refs[formName].resetFields();//清空数据
														           			console.log("回调成功，获取了服务器端返回的值v");
														           			console.log(response.data);	
														           			_this.dialogFormVisible=false;
														           			if(_this.form.salId==null){
															           			_this.$notify({
																           	          title: '添加成功',
																           	          type: 'success',
																           	       	  duration:3000
																           	        });
															           			_this.page.AllpageNumber=_this.page.AllpageNumber+1;
														           			}else if(_this.form.salId!=null){
															           			_this.$notify({
																           	          title: '修改成功',
																           	          type: 'success',
																           	       	  duration:3000
																           	        });
														           			}else{
														           				
														           			}
												           			/*
												           			-----------------------------刷新当前表单信息
												           			*/						           								           			
																	console.log("当前页: "+_this.pageNumber);
																	console.log("每页默认显示的条数:"+_this.pageCententSelect);
																	console.log("当id值: "+_this.form.salId);	
																	
																	if(_this.pageNumber==1||_this.form.salId!=null){
																		_this.tableloading=true;
																	 	axios.get("/sales/competitorPageable",
															           			{
															           		params: {
															          				pageNumber:_this.pageNumber,
															          				pageCentent:_this.pageCententSelect,
															          				DId:_this.DId
															          			    }
															           			}
															           			//ajax请求成功的回调函数
															          			).then(function(response){					          				
															           			console.log("回调成功，获取了服务器端返回的值v");
															           			console.log(response.data);
																				_this.tableData3=response.data.saleOpp;
																				_this.page.AllpageNumber=response.data.salesCount;
															     		 _this.tableloading=false;
															           	}).catch(function(){
															           		alert("显示客户数据出错了");
															           	});												
																	}
							

												           		//this.tableData3=response.data;					           		
												           	//	this.AllpageNumber=this.count/response.data.length;
												     		//  _this.tableData3 = response.data;					     							           					           	
												           	}).catch(function(){
												           		_this.form.customer=i;
												           		alert("新增表单提交出错了");
												           	});				      	  
											          } else {
											            console.log('error submit!!');
											            return false;
											          }
											        });
										        console.log("bibishishsb");												
									            //alert('submit!');
							           			//console.log("log:"+Qs.stringify(this.form,{arrayat: 'brackets'}))		
				 											        
							      },																
								loadInfo(id){
									 // `this` 在方法里指向当前 Vue 实例	

									alert(id);
											
										var _this = this;
					           			var form='';
				           				form=_this.form;
									 	
										/*
										* ------------------这个是修改的时候加载销售机会信息
										*/	 
										if(id!=0){
											 	axios.get("/sales/findOneCompetitor",
									           			//参数转换
									           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
									           			//ajax请求成功的回调函数
									           			{
											 		params:{
											 			salId:id
											 		}
									           			}
									          			).then(function(response){					          				
									           			console.log("回调成功，获取了服务器端返回的值v");
									           			console.log(response.data);
									           			_this.initForm(response.data[0],_this,id);
									           			//_this.salesOpportunityTrackingLogs=response.data[1].UName+;
									           	}).catch(function(){
									           		alert("加载单个销售机会信息出错了");
									           	});		 								
										}else{
											_this.initForm(" ",_this,id);
											
										}
								},
							      //这里是加载外表，对应客户的方法
							     abroadsaleCustName() {
								   var _this=this;
								   //AllpageNumber			   
								 	axios.get("/sales/abroadsaleCustName",
							           			{
							           		params: {
							           			custName:_this.customer
							          			    }
							           			}
							           			//ajax请求成功的回调函数
							          			).then(function(response){					          				
							           			console.log("回调成功，获取了服务器端返回的值v");
							           			console.log("修改:"+response.data);					           		
							           		_this.restaurants=response.data;
							           	}).catch(function(){
							           		alert("加载外表,显示客户初始化数据出错了");
							           	});	//这个是数据的初始化
						          
								      },

										//相当于一种会话，要一次会话结束之后才会变为初始值，废弃
											stateManagement(item,index){
												if(index==1){
													this.state1Flag=item;
													if(this.state1Flag){
														this.state1Session=true;
													}
												}

											},
											//1.当选择其他字段时，清除数据筛选条件中的之前字段的搜索条件
											//2.当字段数据为空时，清除搜索条件
											//3.当字段数据为非比配数据值时，清除搜索条件
											
											//1.是否切换了字段搜索，就将之前的搜索条件删除（不管是否存在），删除时判断是否有不分组条件，存在就设置删除3个元素，否则则为2个元素
											//2.当搜索框搜索条件不存在或者为空时，清除搜索条件，如果存在则保留
											clearData(){	
												console.log("触发方法clearData清除搜索条件判断");	
												console.log("olddata:"+this.data);
												console.log("select:"+this.select);
												console.log("输入框当前值:"+this.state1);	
												var del=null;
												var i=0;
												if(this.selectCopy=='1'){
													del='机会主题';
												}else if(this.selectCopy=='2'){
													del='客户名称';
												}else{
													del='公司名';
												}
												if(this.selectCopy!=this.select){						
													console.log("del:"+del);
													this.data.find((a)=>{									
														if(a==del){
															console.log("a:"+a);
															if(this.data[i+1]=='不分组'){
																this.data.splice(i,3);											
															}else{
																this.data.splice(i,2);											
															}										
														}
														i++;
													});	
												this.selectCopy=this.select;
												}else{
													var flag=this.isMatch();
													console.log("搜索框的值是否匹配:"+flag);								
													if(!flag){
														this.data.find((a)=>{									
															if(a==del){
																console.log("进入:"+flag);
																console.log("a:"+a);
																if(this.data[i+1]=='不分组'){
																	this.data.splice(i,3);											
																}else{
																	this.data.splice(i,2);											
																}										
															}
															i++;
														});										
													}
												}
												console.log("newdata:"+this.data);																						
											},
											//判断是否匹配，采用方案为直接判断当前搜索框结果列表是否存在相同的值
											isMatch(){
												//1.当前的搜索框结果列表没有数据时，则判定为不存在匹配值，返回false
												//2.当前的搜索框结果列表有数据时,厉遍搜索框结果列表数据，如果不存在匹配值则返回false，否则返回true
												//3.当前的搜索框结果列表有数据时且搜索框结果列表数据有且只有只有一条数据，则直接返回true
												
												console.log("触发方法isMatch搜索框的值是否匹配"); 
												console.log("当前的搜索框结果列表数据长度:"+this.restaurants.length);	
												var i=0;
												var obj=false;
												if(this.restaurants.length==0){
													return false;
												}else if(this.restaurants.length==1){
													return true;
												}else{
													this.restaurants.find((a)=>{
														if(this.restaurants[i].value==this.state1){
															obj=true;
														}																				
														i++;
													});
													
													if(obj){
														return true;
													}
													return false;
												}
												
											},						
											//1.当字段不变时，替换原来的字段数据
											//2.当字段不变时,判断搜索框的值是否存在变化,没有变化则index索引值返回0,否则返回index
											//3.当字段不变时且输入宽的值和copy都为初始值时，放回flag=true
											checkData(){
												console.log("触发方法checkData搜索框字段不变时，替换原来的字段数据");
												console.log("olddata:"+this.data);
												console.log("select:"+this.select);
												console.log("输入框当前值:"+this.state1);
												var del=null;
												var i=0;
												var index=0;
												var obj={flag:true,index:index};
												
												if(this.state1Copy!=this.state1||this.state1Copy==''){
													if(this.select=='1'){
														del='机会主题';
													}else if(this.select=='2'){
														del='客户名称';
													}else{
														del='公司名';
													}
													console.log("del:"+del);
													this.data.find((a)=>{									
														if(a==del){
															console.log("a:"+a);	
															index=i+1;
														}
														i++;
													});
													if(index>0){
													obj={flag:false,index:index};
													}
													console.log("index:"+index);	
													console.log("data的长度:"+this.data.length);
													this.state1Copy==this.state1;
												
												}else{
													if(this.state1==''){
														obj={flag:true,index:0};	
													}else{
														obj={flag:false,index:0};
													}
													
													
												}
												
												return obj;	
											},
													      //搜索框，判断是否要进行分组查询
													      isGroup(flag){
													    	  var del=null;
													    	  var i=0;
													    	  var index=0;
													    	  var obj=true;
															    console.log("触发isGroup方法判断是否进行分组查询:"+flag);								    	  
															    console.log("Olddata:"+this.data);
																if(this.selectCopy=='1'){
																	del='机会主题';
																}else if(this.selectCopy=='2'){
																	del='客户名称';
																}else{
																	del='公司名';
																}
																this.data.find((a)=>{									
																	if(a==del){
																		console.log("a:"+a);
																		index=i;
													           			if(this.data[i+1]=='不分组'&&flag){
																			flag=false;
																			index=0;
													           			}
																	}
																	i++;
																});

													    	  if(flag){
													    		  if(index>0){
																		index=index+1;
																		this.data.splice(index,0,'不分组');									    			  
													    		  }
																
													    	  }else{
													    		  index=index+1;	
													    		  if(this.data[index]=='不分组'){	
													    			console.log("ffffffff:");							    			  
																	this.data.splice(index,1);								    			  									    								    			  
													    		  }

														    		  
													    	  }
															   console.log("newdata:"+this.data);
													      },							      
													      //这里是处理搜索框查询字段选择的方法
													      searchSelect(item){
													    	  console.log("item:"+item.value); 
																	var _this = this;											    	
														    		_this.matchFlag=true;												
																	var data=null;
																	this.tableloading=true;
																	//this.clearData();//剔除搜索宽里的分页条件
																	//this.data.push('');
																	var obj=this.checkData();
																	if(obj.index>0){
																		if(item.value!=null){
														           			if(this.data[obj.index]=='不分组'){
																				this.data[obj.index+1]=item.value;									           				
														           			}else{
																				this.data[obj.index]=item.value;	
														           			}														
																		}

																	
																	}
																	this.checkData();//这
																	 this.isGroup(true);
																	data=''+this.data;
												           			console.log("data:"+data);												
																	  //post提交数据
														           	axios.get("/sales/competitorPageable",
														           			{
														           		params: {
														          				pageNumber:1,
														          				pageCentent:4,
														          				DId:data
														          			    }
														           			}
														           			//ajax请求成功的回调函数
														          			).then(function(response){					          				
														           			console.log("回调成功，获取了服务器端返回的值v");
														           			console.log(response.data);
														           		//this.tableData3=response.data;
																		_this.tableData3=response.data.saleOpp;
																		_this.page.AllpageNumber=response.data.salesCount;
														     		 _this.tableloading=false;	
														           	}).catch(function(){
														           		alert("分页数据出错了");
														           	});												    		
													    	  
													    	  
										    	  
													      },
													   	  //这里是筛选查询的方法,有点小问题
													   	 screenQueries(){
													    	  var _this=this;
													    	  var obj=null;
													    	  /*
													    	---------------------------------------数据筛选查询  
													    	 */
													    	 
													    	 console.log("option:"+_this.option);
																var data=new Array();
																var i=0;
																var index=0;
													    	  _this.option.find((a)=>{
														    	  console.log("option:"+a.OldDId+"\t"+a.parent);
														    	_this.data.find((b)=>{
																	if(b===a.parent||a.parent=='全部数据'){
																		index=i;
																	}
																	i++;
														    	  });

														    	 if(index>0){
															    	  console.log("index:"+index);
															    	  if(a.count==2){
																    	  console.log("parent"+a.parent);	
															    		  _this.data[i-1]=a.newDId;	
															    	  }else{
															    		  _this.data[i-1]=a.OldDId;								    		  
															    	  } 									    		 
														    	 }else{
															    	  if(a.count==2){
															    		  _this.data.push(a.parent);
															    		  _this.data.push(a.newDId);	
															    	  }else{
															    		  _this.data.push(a.parent);	
															    		  _this.data.push(a.OldDId);								    		  
															    	  }
														    	 }
					 									    	  
														    	  });	
																this.clearData();//剔除搜索宽里的分页条件								    	  	  
														    	  data=''+_this.data;
														    	  console.log("data:"+data);	
														    	  _this.tableloading=true;
															 	axios.get("/sales/competitorPageable",
													           			//参数转换
												           			//Qs.stringify({ids:_this.value7}, {arrayFormat: 'indices'})
												           			{
													           		params:{
												          				pageNumber:1,
												          				pageCentent:4,		
													           			DId:data
													           		}
													           												 		
												           			}

													           			//json.stringify(this.form)
													           			//ajax请求成功的回调函数
													          			).then(function(response){
															           			console.log("回调成功，获取了服务器端返回的值v");
															           			console.log(response.data);
															           			//console.log(response.data.salesCount);/
																	_this.tableData3=response.data.saleOpp;
																	_this.page.AllpageNumber=response.data.salesCount;
													           	//	this.AllpageNumber=this.count/response.data.length;
													     		//  _this.tableData3 = response.data;	
																	  _this.tableloading=false;
																	_this.value7Copy=_this.value7;//copy值记录value的变化值
													           	}).catch(function(){
													           		//_this.form.customer=i;
													           		alert("筛选查询出错了");
													           	});	

													      },

													      //这里是加载内表，对应客户的方法
													      withinsaleCustName(){
													    	  var _this=this;
													    	  this.isGroup(false);
											           			console.log("Data:"+_this.data);
											           			var data=''+_this.data;
															 	axios.get("/sales/withinsaleCustName",
													           			{
													           		params: {
													           			DId:data
													          			    }
													           			}
													           			//ajax请求成功的回调函数
													          			).then(function(response){					          				
													           			console.log("回调成功，获取了服务器端返回的值v");
													           			console.log("修改:"+response.data);					           		
													           		_this.restaurants=response.data;
													           	
													           	}).catch(function(){
													           		alert("加载内表,显示客户初始化数据出错了");
													           	});	//这个是数据的初始化								    	  
													      },
													      //这里是加载销售机会主题的方法
													   withinSaleFindByTheme(){
													    	  var _this=this;
											           			console.log("Data:"+_this.data);
											           			var data=''+_this.data;
															 	axios.get("/sales/withinCompetitorFindByTheme",
													           			{
													           		params: {
													           			DId:data
													          			    }
													           			}
													           			//ajax请求成功的回调函数
													          			).then(function(response){					          				
													           			console.log("回调成功，获取了服务器端返回的值v");
													           			console.log("修改:"+response.data);					           		
													           		_this.restaurants=response.data;
													           		
													           	}).catch(function(){
													           		alert("加载销售机会主题数据出错了");
													           	});	//这个是数据的初始化								    	  
													      },

													      //这里是加载内表，负责人的方法
													     withinCompetitorFindByComName(){
													    	  var _this=this;
													    	  this.isGroup(false);//查询分组
											           			console.log("Data:"+_this.data);
											           			var data=''+_this.data;											 
																 	axios.get("/sales/withinDetailedcomName",
														           			//参数转换
														           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
														           			//ajax请求成功的回调函数
														           			{
																 				params:{
																 					DId: data
																 				}
														           			}
														          			).then(function(response){					          				
														           			console.log("回调成功，获取了服务器端返回的值v");
														           			console.log("user:"+response.data);
																		/*
																		users:[
																		{
																			value: '选项1',
																			label: '用户名1'					
																		}
																		]
																		*/
															           	//_this.users=response.data;
															          	_this.restaurants=response.data;
														           	}).catch(function(){
														           		alert("加载内表,负责人信息出错了");
														           	});	 
													      },
															 //这个是显示查询的数据
															 querySearchAsync(queryString, cb) {

															        var restaurants = this.restaurants;				       
															        var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;	
															        
															      	console.log("results:"+results);//查看返回结果如果不为空则表示在当前列表中存在比配值，为空表示没有比配值									        
																	        if(queryString==null||queryString.length==0){
															        		 
																	        	 if(this.state1Flag){
																	        		 //当不为空,触发解除搜索功能,且解除搜索没有触发
																	        		 if(this.state1!=null&&this.removeSearch!=true){
																		        		 this.removeSearch=true;										        			 
																	        		 }	
																	        		 var obj=this.checkData();
																	        		 if(obj.flag){
																					     if(this.select=='1'){	    															    	
																					    	 this.data.push('机会主题');
																					    	 this.data.push("%");
																					    	 this.withinSaleFindByTheme();
																					     }else if(this.select=='3'){
																					    	 this.data.push('公司名');
																					    	 this.data.push("%");
																					    	 this.withinCompetitorFindByComName();	 
																					     }else{
																					    	 console.log("this.data:"+this.data);															    	 
																					    	 this.data.push('客户名称');
																					    	 this.data.push("%");
																							 this.withinsaleCustName();										    		 
																					     }													        			 
																	        		 } 															    
																			    	 															     
						 
																	        	 }
																				if(this.customerFlag){
																			    	 this.customer=null;
																			    	  this.abroadsaleCustName();
																							
																				}
																	        	if(this.soltIdFlag){
																				     this.salTheme=null;															    	 
																			    	 this.abroadsaleAddUnameInfo(); 												        	 		
																	        	 }

								       
																		        clearTimeout(this.timeout);
																		        this.timeout = setTimeout(() => {
																		       	cb(this.restaurants);
																		       }, 3000* Math.random());	
																	        }else{
																		      	if(results==''){
																		    	  console.log("queryString3:"+queryString);	
																		    	  if(this.state1Flag){
																		        		 var obj=this.checkData();
																		    		     if(obj.flag){
																						     if(this.select=='1'){
																						    	 this.data.push('机会主题');
																						    	 this.data.push(queryString);
																						    	 this.withinSaleFindByTheme();																    	 
																						     }else if(this.select=='3'){
																						    	 this.data.push('公司名');
																						    	 this.data.push(queryString);
																						    	 this.withinCompetitorFindByComName();	 															    		 
																						     }else{																	    	 
																						    	 this.data.push('客户名称');
																						    	 this.data.push(queryString);
																								 this.withinsaleCustName();											    		 
																						     }														    		    	 
																		    		     }else{
																		    		    	 if(this.data[obj.index]=='不分组'){
																						    	 this.data[obj.index+1]=queryString;													    		    		 
																		    		    	 }else{
																						    	 this.data[obj.index]=queryString;														    		    		 
																		    		    	 }
																						     if(this.select=='1'){
																						    	 this.withinSaleFindByTheme();																    	 
																						     }else if(this.select=='3'){
																						    	 this.withinCompetitorFindByComName();	 															    		 
																						     }else{																	    	 
																								 this.withinsaleCustName();											    		 
																						     }	 
																		    		     }
																		    		  
																		    	  }
																				if(this.customerFlag){
																			    	 this.customer=queryString;
																			    	  this.abroadsaleCustName();																		
																				}
																		        if(this.soltIdFlag){
																				     this.salTheme=queryString;;															    	 
																			    	 this.abroadsaleAddUnameInfo(); 
																	        	 		
																		        }
																				        clearTimeout(this.timeout);
																				        this.timeout = setTimeout(() => {
																				       ;
																				       	cb(this.restaurants);
																				       }, 3000* Math.random());		     

																	        }else{
																		        clearTimeout(this.timeout);
																		        this.timeout = setTimeout(() => {												     
																		       	cb(results);
																		       }, 1000* Math.random());
																		        
																	        }
																		    	  
																	    }						
															      },
															    //这个是根据输入的内容筛选数据
															   createStateFilter(queryString) {
															        return (state) => {return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);};
															      },	
													      //这里是数据筛选标签删除时的事件
													  removeTag(){
													    	  //console.log("item:"+item);	
													    	   console.log("触发removeTag数据筛选标签删除时的事件");
													    	  var _this=this;
													    	  var i=0;
													    	  console.log("value7的当前长度:"+_this.value7.length);
													    	  console.log("value7Copy的当前长度:"+_this.value7Copy.length);
													    	  console.log("value7:"+_this.value7);
													    	  console.log("value7Copy:"+_this.value7Copy);
													    	 var del=null;
													    	 //当value7为空时
													    	  if(_this.value7[0]==null){
													    		  //console.log("dd:"+_this.value7+"d");
													    		  console.log("条件搜索没有了呀，自动添加一个全部数据");
														    		_this.value7[0]='';	//表示添加一个全部数据									    		
															    	  console.log("olddata:"+_this.data.splice(1,1));	
														    		_this.data.push('');
														    		_this.removeSearch=false;
													    	  }
													    	 //查找被删除的值
													    		_this.value7Copy.find((a)=>{								    		  
													    		_this.value7.find((b)=>{ 
																   // console.log("被删除的值:"+b);								    			
													    			if(a!=b){
													    				del=a;

																    console.log("被删除的值del:"+del);	
													    			}
													    		
													    		}); 								    		 
													    	  });
													    	 
													    	  console.log("olddata:"+_this.data);								    	  
													    	  //删除data对等的数据
													    	  _this.data.find((c)=>{
													    		  if(del==c){
															    	  console.log("c:"+c);	
															    	  _this.data.splice(i-1,2);
													    		  }
													    		  i++;  

													    	  });								    	 								    	 
													    	  console.log("newdata:"+_this.data);
													    	  //同步copy值
													    	  _this.value7Copy=_this.value7;
													    	  console.log("新value7Copy:"+ _this.value7Copy);
													    	  var data=''+_this.data;
													    	  _this.tableloading=true;
														 	axios.get("/sales/competitorPageable",
												           			//参数转换
											           			//Qs.stringify({ids:_this.value7}, {arrayFormat: 'indices'})
											           			{
												           		params:{
											          				pageNumber:1,
											          				pageCentent:4,		
												           			DId:data
												           		}
												           												 		
											           			}

												           			//json.stringify(this.form)
												           			//ajax请求成功的回调函数
												          			).then(function(response){
														           			console.log("回调成功，获取了服务器端返回的值v");
														           			console.log(response.data);
														           			//console.log(response.data.salesCount);/
																_this.tableData3=response.data.saleOpp;
																_this.page.AllpageNumber=response.data.salesCount;
												           	//	this.AllpageNumber=this.count/response.data.length;
												     		//  _this.tableData3 = response.data;	
																  _this.tableloading=false;
																_this.value7Copy=_this.value7;//copy值记录value的变化值
												           	}).catch(function(){
												           		//_this.form.customer=i;
												           		alert("筛选查询出错了");
												           	});									    	  
						
													      },
												//这个是列表的选择事件
												 handleSelect(item) {
												    	  /*
												    	  [
												    		  contacts:{
																	con: '选项1',
																	conlabel: '需求主题1'					
																},
																{
																	con: '选项2',
																	conlabel: '需求主题2'					
																}]
												    	  */
												    	  var _this=this;	
													     //   console.log("当前的item的数值:"); 	
													      //  console.log(); 								        
												    	  if(item!=null){
														        console.log("value7Flag:"+this.value7Flag); 
												    		  if(this.value7Flag){							    			
													    		  _this.multipleSelection1(item);  
												    		  }
												    		  if(this.state1Session==true){
												    			  	  this.clearData();//清除搜索框的搜索条件
																	 _this.searchSelect(item);	
																	 //this.removeSearch=true;	
												    		  }
												    	  }else{
												    		
												    	  }	
														 	
												    	  //这里是处理选择对应客户之后，相应的赋值
												    	  if(item.conName!=null){
													    	  var contacts=[{con:item.label2,conlabel:item.conName}];
														        console.log("item:"+item.conName);
														        this.contacts=contacts;		
														        this.form.contact=item.conName;
											           			this.conID=item.label2;
												    	  }
													       if(item.label1!=null){
													        	  this.gdID=item.label1;
													        }
													      
													      },
													      //这里是处理多选条件的方法
													      multipleSelection1(item){
													    	  var _this=this;
													    	  console.log(item[item.length-1]);								    	  
													    		 var DId=item[item.length-1];
													    		  var i=0;
													    		  var count=new Array();
														    	  var obj=null,obj2=null;
										    					  var h=0,j=0;
																  console.log("value7:"+this.value7);
																  
																//  console.log("DId:"+DId);
																  //这里是所选值的循环
																  item.find((c)=>{
																	  console.log("c:"+c);
																	 // console.log("options3:"+_this.options3);
																	  console.log("options3:"+_this.options3.length);
																	  
																	  //下面是的循环代码是判断在同一个父类字典信息中是否存在多个选中的值
																	  
																	  //这里是option3列表循环
																	  _this.options3.find((b)=>{ 
																		  console.log("options3:"+i);
																		  //这里是options所有值的循环
																    	   _this.options3[i].options.find((a)=>{	
															    		   
																    		  console.log("测试："+c);
																    			 if(a.value===c){
																			    	   console.log("当前所在的options："+i);	
																    				// count++;//同一个options选中的值数
																    				 console.log("这个options存在于所选值相等的值");
																    				if(obj2==null){
																    					console.log("当前所在父类："+_this.options3[i].label);
																	    				 obj2={value:i,count:1,OldDId:a.value,parent:_this.options3[i].label,newDId:''};
																	    				 count.push(obj2);
																	    				 console.log("初始化看看是什么：value="+count[0].value+"\tcount="+count[0].count+"\tDId="+count[0].DId);
																    				}else{
																    							
															    					var flag=count.find((j)=>{
															    						//当同一个options的值重复时，修改对应count数组的值即+1	
															    							if(j.value==i){
															    								j.count=2;
															    								j.newDId=a.value;
															    								console.log("看看count数组的值是否改变"+count[h].value+'\t'+count[h].count+"\tDId="+count[h].DId);
															    								return 1;
															    							}
															    							h++;
															    						});
															    						h=0;
															    						 if(flag!=null){
															    							 
															    						 }else{
																		    				 obj2={value:i,count:1,OldDId:a.value,parent:_this.options3[i].label,newDId:''};
																		    				 count.push(obj2);
																		    				 console.log("看看是什么：value="+obj2.value+"\tcount="+obj2.count+"\tDId="+obj2.DId);
															    						 }
																    				}

											    				 
																    			 }//a.value===c	

																    			 
																	    	    });
																    	  console.log("obj:"+obj); 						
																		  i++;  //这里是options的自增索引值
																	  });	
																	  console.log("当前所选值结束列表循环-------------------------------------");
																	  i=0;//将i重新赋值为0
																  });
																  this.removeSearch=true;
																  //这里我们厉遍我们记录的count数组
										    						count.find((it)=>{
																	    console.log("count的当前循环次数:"+h);
																	    if(it==null){
																	    	return 0;
																	    }
										    							//当选择的是全部数据时					    							
										    							if(it.OldDId==''){			    								
																		     console.log("选择的是全部数据:"+_this.value7.length);	
											    								if(_this.value7.length>1){
																				    console.log("count:"+count.length);
											    									count.splice(0,count.length-1);	
																				    console.log("count:"+count.length);	
																				    
											    								}else{					    									
																				     console.log("第一次选择非全部数据删除全部数据:");						    									
												    								 count.splice(h,1);				    									
											    								}
										    								_this.value7.splice(0,_this.value7.length-1);
										    								return 0;

										    							}
										    							
										    							//当同一个的options出现重复值时
										    							if(it.count==2){
															    			 _this.value7.find((b)=>{
																	    		// console.log("obj:"+obj.value); 													    		 
														    				  if(b==it.OldDId){
														    					  console.log("odddddd:"+j.DId);								    					  
														    					 // console.log("obj2:"+_this.obj2.value); 										    					  
																			     console.log("所选值在改变之前的value7:"+ _this.value7); 
														    					  //_this.value7[j]=DId;
														    					  //_this.value7.pop();
														    					 // _this.value7[j]=null;
														    					 //arrayObj.splice(deletePos,deleteCount); //删除从指定位置deletePos开始的指定数量deleteCount的元素，数组形式返回所移除的元素
														    					_this.value7.splice(j,1);
													    					 	 //count.splice(j,1);
														    					  console.log("所选值在改变之后的value7:"+ _this.value7); 
														    					  //_this.obj2.value=obj.value;
														    				  }
													    						
														    				  j++;
														    			  });
															    			 j=0;
										    								//console.log("看看count数组的值是否改变"+count[h].value+'\t'+count[h].count);
										    							}
										    							h++;
												    							
										    						});
										    						this.option=count;
										
													      },

													      //这里是数据筛选下来宽事件
													  visibleChange(){
													    	  this.value7Flag=!this.value7Flag;
													    	  if(this.flag){
													    		  this.flag=false;
															 //copy值记录value的变化值
													    		  if(this.value7Copy==this.value7){
													    			  
													    		  }else{
														    		  this.screenQueries(); 								    			  
													    		  }
													    		  
													    	  }else{
													    		  this.flag=true;

													    	  }
													    	  
													      },    
													      //这里是解除搜索，显示全部数据的方法
													      removeSearch1(){
															//数据筛选下拉框，初始化为全部数据
															this.value7.splice(0,this.value7.length);										
															this.value7[0]='';
															this.value7Copy=this.value7;//copy值记录value的变化值
															this.option=[{count:1,OldDId:'',parent:'全部数据'}];
															//清除搜索条件，只保留“全部数据”这个条件
															this.data.splice(2,this.data.length);
															//调用数据筛选查询
															this.screenQueries();
															//将解除搜索按钮变为不可见
															this.removeSearch=false;
															//清除动态搜索框的输入数据
															this.state1=null;
													      },

															handleClick(row) {
																console.log(row);
															},
															handleSelectionChange(val) {
																//console.log("共:"+val);
																this.multipleSelection = val;
															},											      
															//这个是选择显示数据条数事件
															handleSizeChange(val) {
																var _this = this;
																this.tableloading=true;
																this.pageCententSelect=val;
																console.log("当前页: "+this.pageNumber);
																console.log("每页默认显示的条数:"+this.pageCententSelect);
																this.clearData();//剔除搜索宽里的分页条件
																var data=''+this.data;
															 	axios.get("/sales/competitorPageable",
													           			{
													           		params: {
													          				pageNumber:this.pageNumber,
													          				pageCentent:this.pageCententSelect,
													          				DId:data
													          			    }
													           			}
													           			//ajax请求成功的回调函数
													          			).then(function(response){					          				
													           			console.log("回调成功，获取了服务器端返回的值v");
													           			console.log(response.data);
													           		//this.tableData3=response.data;					           		
																	_this.tableData3=response.data.saleOpp;
																	_this.page.AllpageNumber=response.data.salesCount;
													     		 _this.tableloading=false;
													           	}).catch(function(){
													           		alert("显示客户数据出错了");
													           	});
															},
															//这个是翻页事件
															handleCurrentChange(val) {
																var _this = this;
																this.pageNumber=val;
																this.tableloading=true;
																console.log("当前的分页条件: "+this.data);											
																console.log("当前页: "+val);
																console.log("每页默认显示的条数:"+this.pageCententSelect);
																this.clearData();//剔除搜索宽里的分页条件
																var data=''+this.data;
																  //post提交数据
													           	axios.get("/sales/competitorPageable",
													           			{
													           		params: {
													          				pageNumber:this.pageNumber,
													          				pageCentent:this.pageCententSelect,
													          				DId:data
													          			    }
													           			}
													           			//ajax请求成功的回调函数
													          			).then(function(response){					          				
													           			console.log("回调成功，获取了服务器端返回的值v");
													           			console.log(response.data);
													           		//this.tableData3=response.data;
																	_this.tableData3=response.data.saleOpp;
																	_this.page.AllpageNumber=response.data.salesCount;
													     		 _this.tableloading=false;	
													           	}).catch(function(){
													           		alert("分页数据出错了");
													           	});
															},								      
															//删除方法
															Delete(){
																var _this=this;
																var data=''+this.data;
																axios.get("/sales/CompetitorDelete",
													           			//参数转换
													           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
													           			//ajax请求成功的回调函数
													           			{
																			params:{
																				salId:_this.comId
																			}
													           			}
													          			).then(function(response){					          				
													           			console.log("回调成功，获取了服务器端返回的值v");
													           			console.log(response.data);

													           			//alert(_this.count);
														           			_this.$notify({
															           	          title: '删除成功',
															           	          type: 'success',
															           	       	  duration:3000
															           	        });
														           			/*
														           			-----------------------------刷新当前表单信息
														           			*/
														           			_this.page.AllpageNumber=_this.page.AllpageNumber-1;	
																			console.log("当前页: "+_this.pageNumber);
																			console.log("每页默认显示的条数:"+_this.pageCententSelect);
																			_this.tableloading=true;
																		 	axios.get("/sales/competitorPageable",
																           			{
																           		params: {
																          				pageNumber:_this.pageNumber,
																          				pageCentent:_this.pageCententSelect,
																          				DId:data
																          			    }
																           			}
																           			//ajax请求成功的回调函数
																          			).then(function(response){					          				
																           			console.log("回调成功，获取了服务器端返回的值v");
																           			console.log(response.data);
																					_this.tableData3=response.data.saleOpp;
																					_this.page.AllpageNumber=response.data.salesCount;
																     		 _this.tableloading=false;	
																           	}).catch(function(){
																           		alert("显示客户数据出错了");
																           	});	
																		 	
													           			}).catch(function(){						           				
													           				alert("删除信息出错了");
													           			});
															},		
															/*
															加载表单时的初始化
															*/						
															initForm(json,_this,id){
											           			var form='';
										           				form=_this.form;

															  if(id!=0){
												           			form.comId=id+'';	
												           		
															  }else{
																form.comId=null;
															  }
																/*if(json==" "&&form.salId!=null){

																	this.$refs['form'].resetFields();								  
																}*/

											           			//console.log(json.customerName);
										           				form.customer=_this.toString(json.customerName);
										           				_this.gdID=_this.toString(json.customerId);	
										           				form.comName=_this.toString(json.comName);
										           				form.advantages=_this.toString(json.advantages);
										           				form.comPrice=_this.toString(json.comPrice);
										           				form.comStrategies=_this.toString(json.comStrategies);
										           				form.inferiority=_this.toString(json.inferiority);
										           				form.competingProduct=_this.toString(json.competingProduct);
										           				form.salesOpportunity=_this.toString(json.salesOpportunityName);
										           				_this.salId=json.salesOpportunityId;
										           				
										           				/*form.sotlId=_this.toString(json.sotlId);
											           			form.salStageNotes=_this.toString(json.salStageNotes);
											           			form.custDemand=_this.toString(json.custDemand);
											           			form.salTheme=_this.toString(json.salTheme);	 
											           			form.salStageStop=_this.toString(json.salStageStop);*/
											           			//salTage.push(json.salStagelabel+",value:'1324'");
											           			if(json.comPower!=null){
												           			form.comPower=_this.toString(json.comPower);
											           			}else{
											           				var salTage={};
											           				salTage={label:["忽略"]};
											           				console.log(salTage.label);
											           				form.comPower=_this.toString(salTage.label);
											           			}           				
													           				           		           			
															},
															//强制转换成String类型
															toString(val){
															return val==null?'':(val+'');
															},
															DeleteShow(salId){
																this.comId=salId;
																this.dialogDelete=true;
																
															},

															//优化处理弹框事件
															deathWindow(formName){						
																if(this.dialogFormVisible==false){
																	this.$refs[formName].clearValidate();	
																	this.salesOpportunityTrackingLogs=null;
																}
															},

														      //这个是表单重置方法
														     resetForm(formName) {
														        this.$refs[formName].resetFields();
														      },
														      //这个是表单的取消方法
														      cancelForm(formName){
														    	  this.salesOpportunityTrackingLogs=null;
														    	  this.dialogrepair = false;
														    	  this.dialogFormVisible = false;
														    	  this.$refs[formName].clearValidate();
														      },	
														      print(obj){
															    	/*------------------------------------------*/
															    	//1.让新页面包含之前页面的引用
															    	//2.去掉多余的元素表格
																			 var _this=this;
																				 this.printFlag1=true;
						 													 setTimeout(function(){
																					// newWindow.print();
																					//window.print();	 
																				 _this.printFlag2=true;
																				 }, 300); 
																			 setTimeout(function(){
																					// newWindow.print();
																					//window.print();
																					
																			 var newWindow=window.open("销售机会列表","_blank");
																			 var docStr = document.getElementById("print").innerHTML;
						 													 newWindow.document.write(docStr);
																			 var styles=document.createElement("script");
																			 var link=document.createElement("link");
																			 var script=document.createElement("script");
																			 script.setAttribute('src','https://unpkg.com/element-ui/lib/index.js');
																			 
																			  styles.setAttribute('src','https://unpkg.com/vue/dist/vue.js');// media="print"
																			  
																			  
																			 link.setAttribute('rel','stylesheet');
																			 link.setAttribute('href','https://unpkg.com/element-ui/lib/theme-chalk/index.css');//.appendChild(link).appendChild(script)
																			 
																			  var styleContent=document.createElement("style");
																			  styleContent.setAttribute('type',"text/css");
																			  //width:1010px;height:369px;
																					styleContent.innerHTML="body{margin:0 auto;width:1080px;background:pink;}"			 		
																			 	//页面打印缩放比例设置
																			   //  document.getElementsByTagName('body')[0].style.zoom=0.92;
																			 	
																			 newWindow.document.getElementsByTagName('head')[0].appendChild(styles);	
																			 newWindow.document.getElementsByTagName('head')[0].appendChild(script);
																			 newWindow.document.getElementsByTagName('head')[0].appendChild(link);	
												
																			 newWindow.document.getElementsByTagName('head')[0].appendChild(styleContent);	
																			 //由于采用了引用，需要时间通过网络来获取样式加载，所以要给它加载的时间
																			 //不能采用sleep的方式，会导致浏览器资源被占用，无法加载通过网络获取的颜色		
																			 	 _this.printFlag1=false;
							 													 setTimeout(function(){	 
																					 _this.printFlag2=false;
																					 }, 200); 
																			 setTimeout(function(){

																				 newWindow.print();
																				 newWindow.close(); 
																				//window.print();	 
																			 }, 1000);																								
																				 //_this.printFlag2=true;
																				 }, 2000);
																			
								
															      },
															      
															      //
															      sleep(n){
															    	  var start = new Date().getTime();
															          //  console.log('休眠前：' + start);
															          while (true) {
															              if (new Date().getTime() - start > n) {
															                  break;
															              }
															            }
															      },
															      //表格列样式设置
															       //表格行样式设置	
															      cellStyle({row,rowIndex,column,columnIndex}){
															    	  //column是个对象
															      
															    	  //console.log(columnIndex);
															      
															    	  if(rowIndex==this.pageCententSelect-1){
															    		  return 'border:1px solid #ebeef5;'
															    	  } 									    	  
															    	  
															    	  if(columnIndex==0){
															    		  return 'border-left:1px solid #ebeef5;border-right:1px solid #ebeef5;border-top:1px solid #ebeef5'
															    	  }
															      
															    	  return 'border-right:1px solid #ebeef5;border-top:1px solid #ebeef5;border-left:1px solid #ebeef5'
															      
															    	  },														      
						},
					    //这里是页面初始化时加载数据的事件
					    mounted() {	
						this.data.push('全部数据');
						this.data.push('');
						//这里是加载主题名称信息
				    	this.withinSaleFindByTheme();
						//加载负责人信息
						//this.loadUsers();
						//数据筛选下拉框，初始化为全部数据
						this.value7[0]='';
						this.value7Copy=this.value7;//copy值记录value的初始化值,数据筛选下拉框
						this.valueCopy=this.state1;//copy值记录value的初始化值,搜索框
				    	/*
				    	*
				    	数据筛选下拉框加载数据,加载字典信息
				    	*/					
							var _this = this;
		           			var form='';
	           				form=_this.form;
						 	axios.post("/sales/saleAddcompetitorInfo",
				           			//参数转换id
				           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
				           			//ajax请求成功的回调函数
				          			).then(function(response){					          				
				           			console.log("回调成功，获取了服务器端返回的值v");
				           			console.log(response.data);
				           		 // 竞争能力
				           		_this.comPowers=response.data[0];

					           	// 竞争能力
						    	_this.options3[1].options=response.data[0];
					           	
				           	}).catch(function(){
				           		alert("加载字典信息出错了");
				           	});	
				           	
						//获取当前登录用户的编号
						var arr=new Array();
						var Id='';
							arr=document.cookie;
							console.log("当前用户的cookie:"+arr);
						/*	for(var i=0;i<arr.length;i++){
								if(arr[i]==";"){
									Id=arr.slice(i,arr.length)
								}
							}
							//获取当前登录用户的编号
							console.log("当前用户的cookie:"+Id);*/

					},	
					
						
					}
					var Ctor = Vue.extend(Main1)
					//bigbox
					new Ctor().$mount('#bigbox')
/*---------------------------------------------------------------------------------------------------------------------*/							   
							   
		</script>

</body>
</html>